<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2019/5/27 0027
 * Time: 22:07
 */

namespace app\play\model;


use think\Model;

class Play extends Model
{
    public function source(){
        return $this->hasOne("source","name","from")->field(["parse","show","name"]);
    }

    public static function groupById($id,$from){
        if($from==""){
            return self::with("source")
                ->where("video_id",$id)
                ->order("part","asc")
                ->select();
        }else{
            return self::with("source")->where("video_id",$id)
                ->where("from",$from)
                ->order("part","asc")
                ->select();
        }


    }
}